<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets the normalized value of one of the channels</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="imagickpixel.setcolor.html">ImagickPixel::setColor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="imagickpixel.sethsl.html">ImagickPixel::setHSL</a></div>
 <div class="up"><a href="class.imagickpixel.html">ImagickPixel</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="imagickpixel.setcolorvalue" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ImagickPixel::setColorValue</h1>
  <p class="verinfo">(PECL imagick 2.0.0)</p><p class="refpurpose"><span class="refname">ImagickPixel::setColorValue</span> &mdash; <span class="dc-title">Sets the normalized value of one of the channels</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-imagickpixel.setcolorvalue-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>ImagickPixel::setColorValue</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$color</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$value</code></span>
   )</div>

  <p class="para rdfs-comment">
   Sets the value of the specified channel of this object to the provided
   value, which should be between 0 and 1. This function can be used to
   provide an opacity channel to an ImagickPixel object.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-imagickpixel.setcolorvalue-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">color</code></em></dt>

     <dd>

      <p class="para">
       One of the Imagick color constants e.g. \Imagick::COLOR_GREEN or \Imagick::COLOR_ALPHA.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">value</code></em></dt>

     <dd>

      <p class="para">
       The value to set this channel to, ranging from 0 to 1.
      </p>
     </dd>

    
   </dl>

  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-imagickpixel.setcolorvalue-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-imagickpixel.setcolorvalue-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3259">
    <p><strong>Example #1 Basic <span class="function"><strong>Imagick::setColorValue()</strong></span> usage</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$color&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;\</span><span style="color: #0000BB">ImagickPixel</span><span style="color: #007700">(</span><span style="color: #DD0000">'firebrick'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$color</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setColorValue</span><span style="color: #007700">(</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">::</span><span style="color: #0000BB">COLOR_ALPHA</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.5</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$color</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getcolor</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [r] =&gt; 0.69803921568627
    [g] =&gt; 0.13333333333333
    [b] =&gt; 0.13333333333333
    [a] =&gt; 0.50000762951095
)
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="imagickpixel.setcolor.html">ImagickPixel::setColor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="imagickpixel.sethsl.html">ImagickPixel::setHSL</a></div>
 <div class="up"><a href="class.imagickpixel.html">ImagickPixel</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
